package com.alperez.androidsmscamera.model;

/**
 * Main class which describes all processing of the command from receiving through executing to sending a answer
 * @author Stas
 *
 */
public class SmsTransaction {

	/**
	 * 
	 * @author Stas
	 *
	 */
	public enum TransactionStage {
		CREATED,
		NOT_PARSED,
		PARSED,
		NO_ACCESS_GRANTED,
		ACCESS_GRANTED,
		REJECTED_DEVICE_BUSY,
		WAITING_FOR_EXECUTION,
		EXECUTING,
		EXECUTED
	}
	
	public enum TestAccessResult {
		ACCEPTED,
		NOT_ACCEPTED_ACCESS_DENIED,
		NOT_ACCEPTED_EXPIRED
	}
	
	private UserAccount mAccessUserAccount;
	private String mSource;
	private SmsRequest mSmsRequest;
	private SmsResponse mSmsResponse;
	private TransactionStage mTransactionStage;
	private TestAccessResult mTestAccessResult;
	
	public SmsTransaction(String source) {
		if (source == null) {
			throw new IllegalArgumentException("Valid source (phone number of the requester) must be provided");
		}
		mSource = source;
	}

	public UserAccount getAccessUserAccount() {
		return mAccessUserAccount;
	}

	public void setAccessUserAccount(UserAccount mAccessUserAccount) {
		this.mAccessUserAccount = mAccessUserAccount;
	}

	public String getSource() {
		return mSource;
	}

	public SmsRequest getSmsRequest() {
		return mSmsRequest;
	}

	public void setSmsRequest(SmsRequest mSmsRequest) {
		this.mSmsRequest = mSmsRequest;
	}

	public SmsResponse getSmsResponse() {
		return mSmsResponse;
	}

	public void setSmsResponse(SmsResponse mSmsResponse) {
		this.mSmsResponse = mSmsResponse;
	}

	public TransactionStage getTransactionStage() {
		return mTransactionStage;
	}

	public void setTransactionStage(TransactionStage mTransactionStage) {
		this.mTransactionStage = mTransactionStage;
	}

	public TestAccessResult getTestAccessResult() {
		return mTestAccessResult;
	}

	public void setTestAccessResult(TestAccessResult mTestAccessResult) {
		this.mTestAccessResult = mTestAccessResult;
	}
	
}
